<?php
namespace app\store\controller\shouhuo;

use app\store\model\Card as CardModel;

class Card extends Base
{
    /**
     * 消费卡
     */

    public function obj(){
        return new CardModel();
    }

    //列表
    public function index()
    {
        $res = $this->obj()->index();
        if ($res['code'] < 0) {
            return $this->renderError($res['msg']);
        }
        $list = $res['data'];
        $total = $res['total'];
        return $this->fetch('index', compact('list', 'total'));
    }

    //充值记录
    public function recharge()
    {
        $card_id = $this->request->param('id');
        $res = $this->obj()->rechargeList($card_id);
        if ($res['code'] < 0) {
            return $this->renderError($res['msg']);
        }
        $list = $res['data'];
        $total = $res['total'];
        return $this->fetch('recharge', compact('list', 'total'));
    }
}